import type { PageType } from '../../../lib/page_handler/type'
import type { ModulePlatformConfig } from '../types'
import { ZhiHuQuestionPageType } from '../../../lib/page_handler/platform/zhi_hu_question/types'
import { SUPPORTED_PLATFORMS } from '../../../types/constants'
import { EffectType, SYMBOLS } from '../../../types/interfaces'
import { AppModule } from '../types'

export function getNavigationModules(pageType: PageType): ModulePlatformConfig {
  return {
    [AppModule.NavbarMenu.id]: {
      meta: {
        name: '导航菜单',
        description: '提供页面主导航功能，包含品牌标识、主导航项以及用户菜单',
        category: 'navigation',
        icon: `${SYMBOLS.NETWORK.GLOBE}${SYMBOLS.UI.NAVIGATION}`,
        status: 'not-needed',
        defaultEnabled: true,
        effectType: EffectType.IMMEDIATE,
      },
      supportedPlatforms: {
        [SUPPORTED_PLATFORMS.GREASY_FORK]: {
          status: 'supported',
        },
      },
    },
    [AppModule.AnswerNavigator.id]: {
      meta: {
        name: '回答导航',
        description: '支持快速跳转至指定回答，固定于页面顶部',
        category: 'navigation',
        icon: SYMBOLS.ARROWS.RIGHT,
        status: 'not-needed',
        defaultEnabled: true,
        effectType: EffectType.IMMEDIATE,
      },
      supportedPlatforms: {
        [SUPPORTED_PLATFORMS.ZHI_HU_QUESTION]: {
          status: 'supported',
          pageTypeValidator: () => {
            const supportPages = [
              ZhiHuQuestionPageType.Question,
            ]
            return supportPages.includes(pageType as ZhiHuQuestionPageType)
          },
        },
      },
    },
  }
}
